<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>重置密码页面</title>
    <%@ include file="../headJs.jsp"%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/allcss/register.css" />

</head>
<body id="log" >

<div class="login-wrapper">

    <div class="login-header">
        <img src="../static/images/logo_03.png">
    </div>


            <form class="layui-card-body layui-form layui-form-pane">
                <div class="layui-form-item" style="display: none">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-user"></i></label>
                    <div class="layui-input-block">
                        <input name="id" type="hidden" value="${id}"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
                    <div class="layui-input-block">
                        <input name="password1" type="password" lay-verify="required" placeholder="原密码"
                               class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
                    <div class="layui-input-block">
                        <input name="password" type="password" lay-verify="required" placeholder="新密码"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-ok-circle"></i></label>
                    <div class="layui-input-block">
                        <input name="repassword" type="password" lay-verify="required" placeholder="确认密码"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <button lay-filter="login-submit" class="layui-btn layui-btn-fluid" lay-submit>确 定</button>
                </div>

            </form>
        </div>
    </div>

</div>
<script>
    layui.use(['form','layer'],function () {
        var form = layui.form;
        var layer = layui.layer;
        form.on('submit(login-submit)',function (obj) {

            if(obj.field.password != obj.field.repassword){
                layer.msg('两次密码输入不一致！！！',{icon:5});
                return false;
            }

            // layer.load(2);
            $.post(
                obj.field,
                function (data) {
                    if(data.code == 'blank'){
                        layer.msg(data.msg,{icon:2});
                        layer.closeAll('loading');
                    } else if(data.code > 0){
                        layer.msg("修改成功，即将跳转到登录页面",{icon:1,time:2500},function () {
                            // location.replace('../login/loginForm');
                            window.location = "${pageContext.request.contextPath}/login/loginForm";
                        });
                    } else {
                        layer.msg("修改失败",{icon:2});
                        layer.closeAll('loading');
                    }
                },
                'JSON'
            );
            return false;
        })
    });

    // 图形验证码
    $('.login-captcha').click(function () {
        this.src = this.src + '?t=' + (new Date).getTime();
    });


</script>
</body>
</html>
